
// ***********************************************************************
// AUTO GENERATED CLASS - Do Not Modify this file, if needed modify .tt
// ***********************************************************************
// Assembly         : InnovaApp_DomainLayer
// Author           : LJO+01
// Created          : 05/07/2013 23:07:47
// ***********************************************************************
// <copyright file="N.A." company="Copyright © Innovacall 2011">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary>
// Domain layer  
// DomainClass
// </summary>
// ***********************************************************************

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;


namespace InnovaApp.Layers.DomainLayer
{
    /// <summary>
    /// Class Competency
    /// </summary>
    [Serializable]
    public partial class Competency : _DomainLayer_Base
    {
        #region Primitive Properties
    	
        /// <summary>
        /// Gets or sets Id.
        /// </summary>
        /// <value>The Id.</value>
        public virtual int Id
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Name.
        /// </summary>
        /// <value>The Name.</value>
        public virtual string Name
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Description.
        /// </summary>
        /// <value>The Description.</value>
        public virtual string Description
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets rowversion.
        /// </summary>
        /// <value>The rowversion.</value>
        public virtual byte[] rowversion
        {
            get;
            set;
        }

        #endregion
        #region Navigation Properties
    
        /// <summary>
        /// Link Competency to all Contact__Competency
        /// </summary>
        public virtual ICollection<Contact__Competency> Contact__Competency
        {
            get
            {
                if (_contact__Competency == null)
                {
                    var newCollection = new FixupCollection<Contact__Competency>();
                    newCollection.CollectionChanged += FixupContact__Competency;
                    _contact__Competency = newCollection;
                }
                return _contact__Competency;
            }
            set
            {
                if (!ReferenceEquals(_contact__Competency, value))
                {
                    var previousValue = _contact__Competency as FixupCollection<Contact__Competency>;
                    if (previousValue != null)
                    {
                        previousValue.CollectionChanged -= FixupContact__Competency;
                    }
                    _contact__Competency = value;
                    var newValue = value as FixupCollection<Contact__Competency>;
                    if (newValue != null)
                    {
                        newValue.CollectionChanged += FixupContact__Competency;
                    }
                }
            }
        }
        private ICollection<Contact__Competency> _contact__Competency;

        #endregion
        #region Association Fixup
    
        private void FixupContact__Competency(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.NewItems != null)
            {
                foreach (Contact__Competency item in e.NewItems)
                {
                    item.Competency = this;
                }
            }
    
            if (e.OldItems != null)
            {
                foreach (Contact__Competency item in e.OldItems)
                {
                    if (ReferenceEquals(item.Competency, this))
                    {
                        item.Competency = null;
                    }
                }
            }
        }

        #endregion
    }
}
